//
//  JYSearchHistoryCell.m
//  JYFarm
//
//  Created by 花花 on 2017/10/20.
//  Copyright © 2017年 花花. All rights reserved.
//

#import "JYSearchHistoryCell.h"

@interface JYSearchHistoryCell()

@property(nonatomic)UIView *bgView;

@property(nonatomic)UILabel *titleLabel;

@end

@implementation JYSearchHistoryCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self == [super initWithFrame:frame]) {
     
        [self setupSubView];
    }

    return self;

}

- (void)setupSubView{
    
    [self.contentView addSubview:self.bgView];
    [self.contentView addSubview:self.titleLabel];

}



- (UIView *)bgView{

    if (!_bgView) {
        _bgView = [[UIView alloc]initWithFrame:self.bounds];
        kViewRadius(_bgView, 10);
        _bgView.backgroundColor = kf2Color;
    }
    return _bgView;

}
- (UILabel *)titleLabel{

    if (!_titleLabel) {
        _titleLabel = [UILabel labelText:@"" fontSize:13 textColor:k9Color textAlignment:NSTextAlignmentCenter];

    }
    
    return _titleLabel;

}
- (void)layoutSubviews{

    [super layoutSubviews];
    JYWeakSelf;
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
      
        make.left.mas_equalTo(0);
        make.width.mas_equalTo(weakSelf.contentView.mas_width);
        make.height.mas_equalTo(weakSelf.height);
    }];

}

- (void)setModel:(JYSearchModel *)model{

    _model = model;
    self.titleLabel.text = model.name;


    NSLog(@"%@",self.titleLabel.text);
}

@end
